package com.cb.test;

import java.io.File;
import java.util.HashMap;

import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;

import com.cb.core.service.MailEngine;
import com.cb.core.test.BaseManagerTestCase;

public class MailTestCase extends BaseManagerTestCase{
	private MailSender mailSender=null;

	public void setMailSender(MailSender mailSender) {
		this.mailSender = mailSender;
	}

	private MailEngine mailEngine=null;
	
	
	public void setMailEngine(MailEngine mailEngine) {
		this.mailEngine = mailEngine;
	}


	public void testMail(){
//		SimpleMailMessage smm=new SimpleMailMessage();
//		smm.setSubject("KK is JOh est My Darly");
//		smm.setText("Hello,JIN");
//		smm.setTo("chenshangxuan@mydomain.com");
//		smm.setFrom("chenshangxuan@mydomain.com");
		
		//mailSender.send(smm);
		//mailEngine.sendMessage(smm, "sendMsg.vm", null);
		HashMap model=new HashMap();
		model.put("myname", "Mansan Here Son");
		mailEngine.sendTemplateMail("sendMsg.vm", model, "KMING Test Mine Message", null,
				new String[]{"chenshangxuan@mydomain.com"}, null, null, 
				new String[]{"myTestFile.gif"}, new File[]{new File("D:/4.gif")}, false);
		
		
	}
}
